/**
 * 获取数据类型
 * @param {*} obj 
 * @returns {string} 数据类型
 */
function getType(obj) {
  return Object.prototype.toString.call(obj).slice(8, -1);
}

console.log(getType("hello")); // "String"
console.log(getType(123)); // "Number"
console.log(getType(true)); // "Boolean"
console.log(getType(undefined)); // "Undefined"
console.log(getType(null)); // "Null"
console.log(getType({})); // "Object"
console.log(getType([])); // "Array"
console.log(getType(new Date())); // "Date"
console.log(getType(/\d/)); // "RegExp"
